#!/usr/bin/python2.6
#coding: utf8

import sys
import string

print >> sys.stderr, 'bi...',

TAG_POS = 1<<24
TAG_GRAM = 2<<24
TAG_NR = 3<<24
TAG_NS = 4<<24
TAG_TR = 5<<24
TAG_UNKNOWN = 6<<24

unstat = (
			(0, '始##始'),	(1, '末##末'),
			(2, '未##数'),	(3, '未##数'),
			(4, '未##串'),	(5, '未##串'),
			(6, '未##时'),	(7, '未##时'),
			(8, '未##人'),	(9, '未##人'),
			(10, '未##地'),	(11, '未##地'),
			(12, '未##它'),	(13, '未##它'),
			(14, '未##专'),	(15, '未##专'),
			(16, '未##团'),	(17, '未##团'),
		);

i = 0
for line in sys.stdin :
	i += 1;
	arr = line.split()
	if len(arr) != 3 :
		print >> sys.stderr, 'error field line[', i, ']: ', line
		continue
	word = arr[0]
	freq = arr[2]
	pos = string.find(word, '@')
	if pos < 0 :
		print >> sys.stderr, 'error @ line[', i, ']: ', line
		continue
	word = string.replace(word, '@', '')
	pos += TAG_GRAM

	for i in range(0, 9) :

		key = unstat[i*2][0]
		value = unstat[i*2][1]
		if string.find(word, value) == 0 :
			pos = TAG_UNKNOWN + key
			word = string.replace(word, value, '')

		key = unstat[i*2 + 1][0]
		value = unstat[i*2 + 1][1]
		if string.find(word, value) != -1 :
			pos = TAG_UNKNOWN + key
			word = string.replace(word, value, '')

	if len(word) < 3 :
		print >> sys.stderr, 'error end line[', i, ']: ', line
		continue
	if pos > 0 :
		print >> sys.stdout, word, '\t', pos, '\t', freq
	else :
		print >> sys.stderr, 'err line[', i, ']: ', line

print >> sys.stderr, '\r--bi end--'
